跳到主要内容

GetCell

Returns a cell by its position in the current row.

Syntax

expression.GetCell(nPos);

expression - A variable that represents a ApiTableRow class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nPosRequirednumberThe cell position in the table row.

Returns

ApiTableCell

Example

This example shows how to get a cell by its position in the row.

var oPresentation = Api.GetPresentation();
var oTable = Api.CreateTable(2, 4);
var oRow = oTable.GetRow(0);
var oCell = oRow.GetCell(0);
var oContent = oCell.GetContent();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a sample text in the cell of the first row.");
oContent.Push(oParagraph);
var oSlide = oPresentation.GetSlideByIndex(0);
oSlide.RemoveAllObjects();
oSlide.AddObject(oTable);